/filn,pressure_vessel
/title,the Optimal Design of tank   
!ͼһµķű
*set,R1,1508                   ! Բڰ뾶        
*set,R2,1558                   ! ڰ뾶     
*set,t1,200                    ! ԲǱں
*set,t2,100                    ! Ǳں
*set,H,1600                    ! ߶
*set,L,300                     ! ׶ζγ
*set,press,10                  ! ѹ
*set,theroy,press*R2/(2*t2)    ! ͲӦֵ

/prep7  
et,1,plane82 
keyopt,1,3,1                   !ΪԳ
mp,ex,1,1.765e5                ! ģ
mp,prxy,1,0.3                  !ɱ
*AFUN,DEG                      !ĽǶȵλ
angle=asin(L/R2)               !׶ζǵ
!ģ
BLC4,R1,-(H-L),t1,(H-L)         
PCIRC,(R2+t2),R2,90,angle
a,4,3,5,8
aadd,all

!񻮷
esize,35,0                     !ûֵԪС 
mshape,0,2D                    !ıл
mshkey,0                       !趨ɷ
amesh,all                      !

!ýڵţΪ·
csys,1
nsel,s,loc,x,R2                
nsel,r,loc,y,angle
*GET,num_1,NODE,0,num,max  
!׶ζת۴ؾھnodeţλΪ(R2)
nsel,s,loc,x,R2+t2
nsel,r,loc,y,angle
*GET,num_2,NODE,0,num,max   
!׶ζת۴ؾ⾶nodeţλΪ(R2+t2)
finish  

/solu   
csys,0
nsel,s,loc,y,-(H-L)
d,all,uy               !ģ¶ʩyԼ
csys,0
nsel,s,loc,x,0
DSYM,SYMM,x            ! ģx=0㴦ڵʩxԳԼ
lsel,s,line,,4,10,3
NSLL,s,1
sf,all,PRES,press                     !ڱڽڵʩӾѹ
allsel  
save
solve                                 !
save,pressure_vessel_result           !dbļ
finish  

/post1  
path,path1,2,30,20                     !·
ppath,1,num_1                          
ppath,2,num_2
pdef,mises,s,eqv,avg                   ! ӳӦ·
*get,mises,path,,max,mises             ! õ·Ӧֵ
intens2=mises/theroy                   ! Ӧϵ
lgwrite,pressure_vessel,lgw,,comment   ! Żļ
finish  

/opt                                   ! Ż
opanl,'pressure_vessel','lgw'          ! ȡŻļ
opvar,L,dv,290,320                     ! Ʊ
opvar,angle,sv,0,30                    ! ָ״̬
OPLOOP,PREP,PROC,scalar
opvar,intens2,obj,,,0.0001             ! ָĿ꺯intens2
opsave,'pressure_vessel','opt'         ! Ż״̬
save,pressure_vessel_model    
optype,firs                            ! ָŻΪһ׷
opfrst,20,,,                           ! ָѭ
opexe                                  ! ִŻ
opkeep,on                              ! 
oplist,all,,0                          ! бʾѡ
save,pressure_vessel_opt_result           
/axlab,x,iteration number              ! 趨X
/axlab,y,structural intens             ! 趨Y
plvaropt,intens2                       ! Ŀ꺯ѭ仯ʾ
/axlab,x,L                             ! 趨X
/axlab,y,intens                        ! 趨Y
plvaropt,L,intens2                     ! Ŀ꺯L仯ʾ
finish


 LIST OPTIMIZATION SETS FROM SET   1 TO SET  21 AND SHOW
 ONLY OPTIMIZATION PARAMETERS. (A "*" SYMBOL IS USED TO
 INDICATE THE BEST LISTED SET)

                  SET  1        SET  2        SET  3       *SET  4*
                (FEASIBLE)    (FEASIBLE)    (FEASIBLE)    (FEASIBLE)  
 ANGLE   (SV)     11.102        10.943        11.290        10.918    
 L       (DV)     300.00        295.75        305.01        295.08    
 INTENS2 (OBJ)    1.4379        1.4152        1.4167        1.4149    

                  SET  5        SET  6        SET  7        SET  8 
                (FEASIBLE)    (FEASIBLE)    (FEASIBLE)    (FEASIBLE)  
 ANGLE   (SV)     10.914        11.272        11.488        10.935    
 L       (DV)     294.97        304.53        310.31        295.55    
 INTENS2 (OBJ)    1.4150        1.4163        1.4177        1.4151    

                  SET  9        SET 10        SET 11        SET 12 
                (FEASIBLE)    (FEASIBLE)    (FEASIBLE)    (FEASIBLE)  
 ANGLE   (SV)     10.916        10.800        10.727        10.751    
 L       (DV)     295.05        291.93        290.00        290.64    
 INTENS2 (OBJ)    1.4150        1.4185        1.4181        1.4183    

                  SET 13        SET 14        SET 15        SET 16 
                (FEASIBLE)    (FEASIBLE)    (FEASIBLE)    (FEASIBLE)  
 ANGLE   (SV)     10.941        11.279        11.493        10.978    
 L       (DV)     295.70        304.71        310.42        296.70    
 INTENS2 (OBJ)    1.4152        1.4164        1.4177        1.4154    

                  SET 17        SET 18        SET 19        SET 20 
                (FEASIBLE)    (FEASIBLE)    (FEASIBLE)    (FEASIBLE)  
 ANGLE   (SV)     10.919        10.915        10.910        10.797    
 L       (DV)     295.12        295.01        294.87        291.86    
 INTENS2 (OBJ)    1.4149        1.4150        1.4150        1.4185    

                  SET 21 
                (FEASIBLE)  
 ANGLE   (SV)     10.727    
 L       (DV)     290.00    
 INTENS2 (OBJ)    1.4181